/*************************************************************************
 * File Name:    A.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Tue 15 Oct 2013 08:15:16 PM CST
 * 
 * Description:  http://codeforces.com/contest/356/problem/A
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <iomanip>

using namespace std;

#define MAXN 300010

int ans[MAXN], next[MAXN];
int n;

int
get_next(int x)
{
    if (ans[next[x]] == -1) return next[x];
    next[x] = get_next(next[x]);
    return next[x];
}

int
main(int argc, char *argv[])
{
    //std::ios_base::sync_with_stdio(false);
    int m, l, r, x;

    while (scanf("%d %d", &n, &m) != EOF) {
        for (int i = 0; i <= n + 1; ++i) {
            next[i] = i + 1;
            ans[i] = -1;
        }

        while (m--) {
            scanf("%d %d %d", &l, &r, &x);

            if (ans[l] == -1 && l != x) ans[l] = x;

            for (int i = get_next(l); i <= r; i = get_next(i)) {
                if (i == x) continue;
                ans[i] = x;
            }
        }
        for (int i = 1; i <= n; ++i) {
            printf("%s%d", i == 1 ? "" : " ", ans[i] == -1 ? 0 : ans[i]);
        }
        printf("\n");
    }
    return 0;
}
